package com.kuiandjie.service;

import java.util.List;

import com.kuiandjie.dao.ProjectDao;
import com.kuiandjie.entity.Project;
import com.kuiandjie.util.DateUtil;

public class ProjectService {
	
	private ProjectDao dao = new ProjectDao();

	public List<Project> getAllProByEmployeeId(int id) {
		return dao.findRelProjectByEmployeeId(id);
	}

	public void createNewProject(int id, String proName, int leaderId,
			String[] memberIds, String desc) {
		String createTime = DateUtil.getNow();
		int proId = dao.insertProject(proName, desc, createTime);
		
		EmployeeProjectService eps = new EmployeeProjectService();
		eps.createEmplPro(id, proId, leaderId, memberIds);
	}

	public Project findProById(String curpid) {
		
		return dao.findProById(curpid);
	}

	public Project getProjectByEmpIdAndProId(int nameId, int proId) {
		return dao.getProByEmpIdAndProId(nameId, proId);
	}

}
